import React, { Suspense } from 'react';
import { Spin } from 'antd';

const Loading = () => {
  return (
    <Spin tip="加载中" size="large">
      <div className="load-module-div" />
    </Spin>
  );
};

export default function SplitComponent(Comp, stores = {}) {
  const LazyComp = React.lazy(Comp);
  return (props) => (
    <Suspense fallback={<Loading />}>
      <LazyComp {...props} />
    </Suspense>
  );
}
